package com.byxy.service.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import com.byxy.dao.LogDao;
import com.byxy.entity.Log;
import com.byxy.service.LogService;

@Service
@Transactional
public class LogServiceImpl implements LogService {
	@Resource
	private LogDao logDao;

	@Override
	public List<Log> listAll() {
		return logDao.find();
	}

	@Override
	public void delete(int id) {
		Log s = new Log();
		s.setId(id);
		logDao.delete(s);

	}

	@Override
	public void save(Log log) {
		logDao.add(log);
	}

	@Override
	public List<Log> listPage(int page, int rows) {
		int pos = (page - 1) * rows;
		return logDao.find(pos, rows);
	}

	@Override
	public long count() {
		return logDao.count();
	}

	@Override
	public void deleteAll() {
		logDao.deleteAll();
	}

}
